package com.lp.controller;

import com.lp.properties.GirlProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * Created by lp
 * 2017/11/7 16:35
 */
public class HelloController {

    //    @Value("${cupSize}")
    //    private String cupSize;
    //
    //    @Value("${age}")
    //    private Integer age;
    //    @Value("${content}")
    //    private String content;
    //
    //    @RequestMapping(value = "hello", method = RequestMethod.GET)
    //    public String say() {
    //        //return "Hello Spring Boot!"+cupSize+age;
    //        return content;
    //    }

    @Autowired
    private GirlProperties girlProperties;

    //    @RequestMapping(value = {"/hello","hi"}, method = RequestMethod.GET)
    //    public String say() {
    //        return girlProperties.getCupSize();
    //        //return "index";
    //    }

    //    @RequestMapping(value = "/say/{id}", method = RequestMethod.GET)
    //    public String say(@PathVariable("id") Integer id) {
    //        return "id:"+id;
    //    }

    @RequestMapping(value = "/say", method = RequestMethod.GET)
    public String say(@RequestParam(value = "id", required = false, defaultValue = "10") Integer id) {
        return "id:" + id;
    }
}
